import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;


public class HandlingMultipleWindows {

	public static void main(String[] args) throws InterruptedException {
		WebDriver driver= new FirefoxDriver();
		driver.get("http://www.hdfcbank.com/");
		driver.findElement(By.xpath(".//*[@id='cee_closeBtn']/img")).click();
		driver.manage().window().maximize();
		
		//First find the xpath of the element you want to click
		driver.findElement(By.xpath("html/body/div[1]/div[2]/div[2]/div[2]/ul/li[7]/div[1]/span")).click();
		
		//Create Actions class to bring the cursor over goldloan option in dropdown list 
		Actions ab = new Actions(driver);
		
//Use CssSelector to handle UI droplist using syntax[attribute*='value'] or tagname[attribute*='value']
		driver.findElement(By.cssSelector("[href*='goldloan']"));
		//move to the element that you want click on by using moveToElement, build and perform method
		ab.moveToElement(driver.findElement(By.cssSelector("[href*='goldloan']"))).build().perform();
		Thread.sleep(7000L);
		//Then use driver to click on that element by using sendkeys(Keys.ENTER)
		driver.findElement(By.cssSelector("[href*='goldloan']")).sendKeys(Keys.ENTER);
		
		//Thread.sleep(6000L);		
		//driver.switchTo().window("http://www.hdfcbank.com/");
	
		
	}

	}


